{%include file="header.tpl"%}
<script>

 function removeAllSpace(str){     
    var localString = '';     
    for(var index = 0; index<str.length; index++)     
        if(str.charCodeAt(index)!= 32){     
            localString += str.charAt(index);     
        };     
    return localString;     
    }     
  
 var powers=new Array("7","9","10","5","8","4","2","1","6","3","7","9","10","5","8","4","2");     
var parityBit=new Array("1","0","X","9","8","7","6","5","4","3","2");     
var sex="male";     
//验证身份证  
function validId(){   
	var obj = $("#identity_card").val();
    var _id=removeAllSpace(obj);    
    if(_id==""){  
       alert("身份证号码不能为空！");    
       return false;   
    }    
    var _valid=false;     
    if(_id.length==15){     
        _valid=validId15(_id);     
    }else if(_id.length==18){     
        _valid=validId18(_id);     
    }     
    if(!_valid){     
        alert("身份证号码有误！请您核对");     
        document.getElementById("identity_card").focus();  
        return false;     
    }     
    return true;  
}         
//18  
  
function validId18(_id){     
    _id=_id+"";     
    var _num=_id.substr(0,17);     
    var _parityBit=_id.substr(17);     
    var _power=0;     
    for(var i=0;i< 17;i++){     
  
        if(_num.charAt(i)<'0'||_num.charAt(i)>'9'){     
            return false;     
            break;     
        }else{     
  
            _power+=parseInt(_num.charAt(i))*parseInt(powers[i]);     
        }     
    }     
  
    var mod=parseInt(_power)%11;
    if(_parityBit=='x'){
	_parityBit='X';
    }
    if(parityBit[mod]==_parityBit){     
        return true;     
    }     
    return false;     
}     
//15  
  
function validId15(_id){     
    _id=_id+"";     
    for(var i=0;i<_id.length;i++){     
        if(_id.charAt(i)<'0'||_id.charAt(i)>'9'){     
            return false;     
            break;     
        }     
    }     
    var year=_id.substr(6,2);     
    var month=_id.substr(8,2);     
    var day=_id.substr(10,2);     
    var sexBit=_id.substr(14);     
  
    if(year<'01'||year >'90')return false;     
  
    if(month<'01'||month >'12')return false;     
  
    if(day<'01'||day >'31')return false;     
    return true;     
}


function isMobilePhone(){
	var partten = /^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}|15[0-9]\d{8}|189\d{8}$/;
	var obj = $("#user_mob").val();
	if(partten.test(obj)){
		return true ;
	}else{
		//$("#mob").html('请输入正确的手机号');
		alert('请输入正确的手机号');
		document.getElementById("user_mob").focus();  
		return false ;
	}
}

function is_real_name(){
	var obj = $("#real_name").val();
	if(obj!=''){
		return true ;
	}else{
		alert('请输入姓名');
		
		return false ;
	}
}

function is_ver_code(){
	var obj = $("#code").val();
	if(obj!=''){
		return true ;
	}else{
		alert('请输入验证码');
		
		return false ;
	}
}

function is_checked(){
	if($("#check_agree").attr("checked")==false){
		alert('同意服务条款才能继续');
		return false;
	}else{
		return true;
	}
}

function ver_post(){
	//验证身份
	var obj = $("#identity_card").val();
    var _id=removeAllSpace(obj);    
    if(_id==""){  
       alert("身份证号码不能为空！");    
       return false;   
    }    
    var _valid=false;     
    if(_id.length==15){     
        _valid=validId15(_id);     
    }else if(_id.length==18){     
        _valid=validId18(_id);     
    }     
    if(!_valid){     
        alert("身份证号码有误！请您核对");     
        document.getElementById("identity_card").focus();  
        return false;     
    }     
	//验证手机
	//var partten = /^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}|15[0-9]\d{8}|189\d{8}$/;
	var partten = /^0?(13[0-9]|15[012356789]|18[0236789]|14[57])[0-9]{8}$/;
	var obj1 = $("#user_mob").val();
	if(!partten.test(obj1)){
		//$("#mob").html('请输入正确的手机号');
		alert('请输入正确的手机号');
		document.getElementById("user_mob").focus();  
		return false ;
	}
	     //验证验证码
	 var flag = true;
     $.ajax({
		type: "POST",
		async:false,
 		url: "{%$host_name%}/ajax_vcode.php",
 		data:   {ver_code:$("#code").val()},
 		dataType:'html',
 		success: function(data){
 			//验证成功
 			if(data!=''){
 				alert(data);
 				flag = false;
 			}else{
 				flag = true;
 			}
 		},
 		error: function(){
 			alert('系统错误');
 			flag = false;
 		}
	});
	//验证姓名
	var obj2 = $("#real_name").val();
	if(obj2==''){
		alert('请输入姓名');
		
		return false ;
	}
	
	if($("#check_agree").attr("checked")==false){
		alert('同意服务条款才能继续');
		return false;
	}else{
		return true;
	}
	
	return flag;

	
    
}
</script>

            <div class="main_left">
        	<div class="frameNav">
            	<h1>01</h1>
                <span class="new"><a class="cur">新用户认证</a></span>
               <span class="old"><a href="fourth_step.php">身份通用户</a></span>
                <em>选择您的认证方式</em>
            </div>
            <div class="frame_c">
            	<form name="form1" method="post" action="{%$host_name%}/second_step.php" onsubmit="return ver_post()">
            	<dl>
                	<dt>新用户认证</dt>
                    <dd>
                    	<div class="fname"><em>*</em>您的姓名</div>
                        <div class="finput">
                        	<input type="text" name="real_name" id="real_name" class="tanch_input"/>
                            <em>请输入您在身份证上的姓名</em>
                        </div>
                    </dd>
                    <dd>
                    	<div class="fname"><em>*</em>身份证号</div>
                        <div class="finput">
                        	<input type="text" name="identity_card" id="identity_card" class="tanch_input"/>
                   			<input type="hidden" name="temp_id" value="{%$temp_id%}">
                    		<input type="hidden" name="icpcode" value="{%$icpcode%}">
                    		<input type="hidden" name="user_id" value="{%$user_id%}">
                            <em>请输入您在身份证上的身份证号码</em>
                        </div>
                    </dd>
                    <dd>
                    	<div class="fname"><em>*</em>手机号码</div>
                        <div class="finput">
                        	 <input type="text" name="user_mob" id="user_mob" class="tanch_input"/>
                            <em>手机号码用于接收短信验证码</em>
                        </div>
                    </dd>
                    <dd>
                    	<div class="fname"><em>*</em>验证码</div>
                        <div class="finput">
                        	<input type="text" name="ver_code" id="code"  class="tanch_input"/>
                            <p id="icode"><img src="{%$host_name%}/yz.php" title="" onclick="this.src='{%$host_name%}/yz.php?a='+Math.random();"/></p>
                            <span id="acode"><!--<a href="#" >换一张</a>--></span>
                        </div>
                    </dd>
                    <dd class="fcbox">
                    	<div class="promise">我们承诺并保证不会泄露您的信息，请放心填写</div>
                    	<input type="checkbox" id="check_agree" value="" checked class="checkbox" />
                        <a href="deal.html" target="_blank">我已经阅读并同意《身份通服务条款》</a>
                    </dd>
                    <dd class="fbtn">
                    	<input type="submit"  value="" />
                    </dd>
                </dl>
                </form>
            </div>
            <div class="main_ad"><img src="{%$pic_path%}ad.jpg" title=""/></div>
        </div>
       <div class="main_right">
        	<div class="webLogo"><img src="{%$pic_path%}{%$logo%}" title=""/></div>
             <h5>{%$info%}实名认证由国政通公司提供支持</h5>
            <h1>为什么要进行实名认证？</h1>
            <p><a href="http://help.baihe.com/index.php?action=list&cat=494&listid=21" target="_blank">1、实名认证可有效预防身份信息被冒用风险</a></p>
            <p><a href="http://help.baihe.com/index.php?action=list&cat=494&listid=21" target="_blank">2、完成实名认证，点亮专属认证标识</a></p>
            <p><a href="http://help.baihe.com/index.php?action=list&cat=494&listid=21" target="_blank">3、提升您的诚信星级，拥有更多会员的关注</a></p>
            <p><a href="http://help.baihe.com/index.php?action=list&cat=494&listid=21" target="_blank">4、认证会员优先排序，还有获得更多推荐展示的机会</a></p>
        </div>
        <div class="clear"></div>
    </div>
    
    <div id="footer">
    	<a>版权所有 北京国政通科技有限公司 京ICP证031065号 北京市公安局计算机信息网络单位备案编号 1101081071<br>
Copyright 2004-2011 id5.cn idv5.com, All Rights Reserved.</a>
    </div>    
</div>
{%include file="footer.tpl"%}
